/*
 * This file is part of aion-emu <aion-emu.com>.
 *
 *  aion-emu is free software: you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation, either version 3 of the License, or
 *  (at your option) any later version.
 *
 *  aion-emu is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with aion-emu.  If not, see <http://www.gnu.org/licenses/>.
 */
package com.aionemu.gameserver.model.gameobjects.stats;

import com.aionemu.gameserver.model.gameobjects.Creature;

/**
 * @author xavier
 *
 */
public class Stat
{
	public float			base;
	public float			bonus;
	private Creature 	owner;

	public Stat(float origin, Creature owner)
	{
		this.base = origin;
		this.bonus = 0;
		this.owner = owner;
	}

	public Stat()
	{
		this(0, null);
	}

	
	public float getBase()
	{
		return base;
	}

	public float getBonus()
	{
		return bonus;
	}

	/**
	 * @param base The base to set.
	 */
	public void setBase(float base)
	{
		this.base = base;
	}

	/**
	 * @param bonus The bonus to set.
	 */
	public void setBonus(float bonus)
	{
		this.bonus = bonus;
	}

	public float getCurrent()
	{
		return base + bonus;
	}

	public int getCurrentInt()
	{
		return Math.round(base + bonus);
	}
	/**
	 * @return Returns the owner.
	 */
	public Creature getOwner()
	{
		return owner;
	}

	public void reset()
	{
		base = 0;
		bonus = 0;
	}

	@Override
	public String toString()
	{
		final String s = base + "+" + bonus;
		return s;
	}

	/**
	 * @return
	 */
	public int getBaseInt()
	{
		return Math.round(base);
	}
}
